README.TXT for Brainiac Behavior Engine v1.0

WHAT IS THE BRAINIAC BEHAVIOR ENGINE?
----------

Brainiac Behavior Engine (or Brainiac BE) is a highly customizable state-of-the-
art AI engine; it is primarily designed for creating computer role-playing games
(CRPGs) that feature lifelike behavior on the part of computer-controlled
characters. Brainiac BE is virtually weightless so far as maintenance is
concerned, can be tweaked in every possible direction, and is more advanced than
any functionality that could be created from scripts. The list below mentions
only a few of the Brainiac capabilities:

  *  Intelligent and reasoned responses to player actions by any computer
controlled characters.

  *  Character actions are dependant on state of mind and practical
considerations.

  * Characters themselves are not static or merely reactive. They will pursue
their own interests and independently assign themselves goals with or without
player actions.

  *  Brainiac BE includes a groundbreaking model of verbal interaction. No more
painstakingly scripted multi-choice conversations! In Brainiac, conversation has
become the use of verbal actions; a powerful tool for enabling non-linear plots.

  * Flexibility. The game designer defines character actions, goals, strategies
and mindsets. The Brainiac BE data management utility makes this process easy --
no programming skills are required! Beyond the designer's imagination, there are
no limits at all.

Brainiac BE uses a simple and effective object oriented model to simulate
character decision-making processes at a high level.

EXAMPLES
----------

The complexity of character behavior grows with the number of strategies, goals
and actions.  Make no mistakes -- all these lifelike side effects are not
preprogrammed for each situation. They arise from Brainiac BE's common-sense
algorithms.

A developer new to Brainiac BE can find it very difficult to force a given
set of events to take place. Persevere! A few tried and tested examples are
provided with this software (and there are also saved character sets for the
debugger).

1) Hostility, General and Specific

The "natural" way to set up hostility between characters is to create a first
character that does not like the appearance of the second, target character.
Chaotic Evil characters are perfect in this role. They don't like anyone who is
different, no matter whether the difference is in abilities or wealth. However,
Chaotic Evil characters tend to be too active, and will abuse, rob and attack
right from the start.  If you want to set up a more sedate or controlled
situation, you should use another mindset and set a hostile attitude (of less
than -80) explicitly. Another equally viable method would be to create an evil
character who possesses neutral or friendly attitudes towards everyone else
except the potential targets or victims.

2) Robbery (and Murder?)

How to set up  a robbery? Firstly, you  should create at least  2 characters who
have a difference in  combat ability of 3  or more. The stronger  character must
be evil (Chaotic Evil is the best bet, but see the previous comments on  keeping
things under control), or threats  and possible murder would be  unacceptable to
him  or  her.   The  weaker  character  should  have possess an item with scores
greater than 4, while  the stronger villain should  have no sufficient means  to
purchase that item (meaning  his or her cash/2  is less than the  item's price).
It is very likely that a  Chaotic Evil character will rob the  weaker character.
You could even create a more colorful variant of this scenario: make the  weaker
character  foolhardy  (intelligence  <  9  and  courage  > 11) so that he or she
possibly would  not accept  threats.   In this  case, the  villain will probably
attempt to kill the foolhardy weaker character and take the desired item.

3. Ordering an Assassination

You  should  have  one  character  anger  another  (or take the shortcut and set
attitude < -80 explicitly). The angered character should be much weaker than the
character that he or she now  hates (the difference in combat ability  should be
greater than  3). You  will also  need a  third character  (the assassin) who is
stronger than both the angered character and the object of his or her anger. The
assassin should probably  have an evil  mindset. Under these  circumstances, the
angered character should now attempt to pay  for the death of his or her  enemy.
However, if assassin does not hate the potential victim and the proposed sum  of
money is not high  enough, the deal is  likely to be off.  Plan on it taking  at
least 2500 in cash  to assassinate a character  neutral to (or unrecognized  by)
the assassin.

4. Conspiracy!

This is a little more complex, but illustrates how quickly a Brainiac BE model
can become just as convoluted as any soap opera. Set up characters A, B, C and
D. A is hostile to B, while C is stronger than B. C is favorably inclined
(attitude > 75) towards D. A will probably attempt to turn C against B by
telling C that B attacked D at some point in time. A will then ask C to kill B.
If C refuses, A will attempt to find another candidate (if there are more pairs
of characters like C and D). After failing for a while, A will probably drop
this strategy as being useless.

BASICS OF THE BRAINIAC BEHAVIOR ENGINE
----------

The three basic conceptual units of behavior used in Brainiac BE are Goals,
Actions and Strategies. As in real life, characters set Goals and then search
for suitable Strategies to obtain these Goals.

A Strategy consists of one or more Actions; if a character evaluates the Actions
making up a Strategy to have a reasonably chance of success (and to be morally
acceptable), the Strategy will be adopted and the Actions scheduled. For
example, every character might want to acquire a given expensive item. Some
characters might be able to purchase the item, while others might be able to
steal the item. Most characters will not find a suitable and morally acceptable
Strategy and will put the whole issue to one side. (At least, this is the way it
should be to prevent unwanted hyperactivity on the part of your characters. The
level of activity is -- of course -- configurable through your own settings).

Characters will attempt Actions on every "environment change" (that is, when a
character leaves, disappears, changes state, arrives or appears). In the
debugger, Actions are executed continuously because there are no other tasks.

Every Action and Strategy includes an Objective. The Objective is a character
targeted by this particular Action. A Strategy Objective is not necessarily the
Objective of every Action that is a part of that Strategy (you can look at the
examples, such as conspiracy or assassination, using the Brainiac BE Data
Manager).

A Criteria Id must be specified in order to choose an Objective. A Criteria is
set of limits defining, as you might expect, criteria for the potential
Objective. Technically, Criteria records are stored in a Goal file, as both use
the same format and are conceptually close.  Flags and limitations also exist
in connection with Actions, such as conditional loops in case of failure and
referenced Objectives.

An important point to take note of is the difference between Goals and
Strategies. A Goal is a morally independent state that a character might want to
achieve. For example, neither stealing nor buying an item is a Goal. Both are
Strategies for acquiring this item. To determine the real Goal, consider an
alternate Strategy that leads to the same end state.

VERBAL INTERACTION
----------

For now, Brainiac BE supports five verbal Actions: Deal, Request, Statement,
Tease and Threat. These Actions allow for more than it might seems first, and
end-user programmers can add their own verbal Actions to the list.

1) Deal

Deal is a generic commercial Action ("trade offer" is used in the Brainiac BE
Data Manager to set constraints for Deal). A Deal can be divided into two parts:
the proposed Action and the requested Action. If either of the two Actions has a
non-NULL pointer to an inventory item, the item is evaluated instead of used n
an Action. This means that Deal can describe nearly every basic form of
transaction; paying for a service, exchanging or buying items and exchanging
services, to name a few. The evaluation of a Deal Action is also influenced by
the attitudes of the Dealing characters.

2) Request

Request is as universal as Deal, but it contains only one Action -- the requested
Action. In other words, a Request it is the same as a Deal, but without a
proposed Action.

3) Statement

A Statement reports an Action (only one Action for the moment) to another
character. Why bother? Well, take a look at the conspiracy example for the use
of a Statement to manipulate another character. A Statement can be either true
or a lie. It can describe events that happened in the past, are happening now,
or that can happen in the future.

The character receiving a Statement (the Statement Objective) will evaluate the
reported Action and the reporting character. If the information is believed,
attitudes may change.

In Brainiac BE, the reported Action is first defined in the Data Manager ("A").
The target of this Action defines the reported Action initiator. The second
Action ("B") must be present, but only to define the reported Action Initiator.
It is advisable to use the "dummy" Action, just to prevent confusion.

(All verbal actions by definition containing only one content Action, are
defined in A-B, content Action - initiator holder fashion).

4) Tease

Tease does not provide much functionality. It just makes use of a small function
for generating insults by comparing personal characteristics. For example, a
physically strong character could call a weaker opponent "wimp," while a smarter
character would refer to a dumber target as "idiot," and so on. Insults are
sorted by the difference in abilities -- that is, the greatest difference comes
first.

5) Threat

Threat resembles Deal in many aspects, except that both Actions are viewed as
undesirable by the Objective character. The aim is to make the Objective
character consider alternate Strategies to prevent the "proposed" Action on the
part of the Threatening character. This algorithm needs overall improvement.


Twilight Minds Design Group

Email: bbe_support@twilightminds.com
Homepage: http://www.twilightminds.com

BRAINIAC IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS
ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES.


